﻿using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;
using System.Text;

namespace IHISCETeim.Web.MachineSys.FTradeModel
{
    public partial class FTradeCatheringEdit : PageBase
    {
        protected override string DWZRef
        {
            get
            {
                return "FTradeCatheringListEasyUI";
            }
        }

        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.修改 };
            }
        }

        protected int FCatheringId
        {
            get
            {

                return GetRequestValue<int>("FCatheringId", 0);
            }
        }

        private FTradeCatheringInfo _objFx = null;

        protected FTradeCatheringInfo obj
        {
            get
            {
                if (_objFx == null)
                    _objFx = FTradeCatheringController.GetById(FCatheringId);
                return _objFx;
            }
        }


        

        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "edit")
            {
                addmenu();
                
            }
        }
        private void addmenu()
        {
            FTradeCatheringInfo objTrade = Request.SerializableObject<FTradeCatheringInfo>();
            objTrade.oldKuanXiangLeiXing = objTrade.KuanXiangLeiXing;
            if (string.IsNullOrEmpty(objTrade.KuanXiangLeiXing))
            {
                ErrorJson("请选择款项类型.");
                return;
            }
            bool msg = FTradeCatheringController.Update(objTrade);

            AddLog(Permission.修改, obj, objTrade);

            if (msg)
                SuccessJson("修改成功");
            else
            {

                ErrorJson("修改失败");
            }
        }

        
    }
}